package org.hackday.evetteam;


import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;


import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;

public class createEvent extends Activity {

	private ImageView icon;
	private TextView text;
	String i1,i2,i3,i4,i5,i6;
	private createEvent ahp;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.ajax);
        
        icon = (ImageView) findViewById(R.id.icon);
        text = (TextView) findViewById(R.id.text);
        
       // downloadTwitterIcon();
       // downloadTwitterStream();
        
        Bundle extras = getIntent().getExtras();
         i1 = extras.getString( "creatorname" );
         i2 = extras.getString( "eventname" );
         i3 = extras.getString( "venue" );
        // i4 = extras.getString( "dateofevent" );
         i5 = extras.getString( "starttime" );
         i6 = extras.getString( "endtime" );
        downloadEventsList();
        ahp=this;
        
        String url="http://172.16.6.110:8080/EventsServer/event.jsp?eventId=0&creatorId="+i1+"&from="+i5+"&to="+i6+"&location="+i3+"&eventName="+i2;
        Context context; 
        int duration = Toast.LENGTH_SHORT;
		context = getApplicationContext();
		Toast toast = Toast.makeText(context, url, duration);
		//toast.setGravity(Gravity.CENTER, 0, 0);
		//toast.show();
    }
    
    
    public void downloadEventsList() {
		Handler handler = new Handler() {
			public void handleMessage(Message message) {
				switch (message.what) {
				case HttpConnection.DID_START: {
					Log.d("Twitter Icon", "Starting Connection");
					break;
				}
				case HttpConnection.DID_SUCCEED: {
					String response = (String) message.obj;
					//text.setText(response);
					//Intent i = new Intent(this, EventViewActivity.class);
					
					break;
				}
				case HttpConnection.DID_ERROR: {
					Exception e = (Exception) message.obj;
					e.printStackTrace();
					break;
				}
				}
			}
		};
		//http://localhost:8080/EventsServer/event.jsp?eventId=2&creatorId=2&from=aug3&to=aug4&location=MV&eventName=hackathon
		new HttpConnection(handler)
				.get("http://172.16.6.110:8080/EventsServer/event.jsp?eventId=0&creatorId="+i1+"&from="+i5+"&to="+i6+"&location="+i3+"&eventName="+i2);
	}
    
	
	
}